﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Models;
using DAL;
namespace BLL
{
    public class LandNodeManager
    {
        LandNodeService objLandNodeService = new LandNodeService();
        /// <summary>
        /// 按工程文件ID读取所有地标信息
        /// </summary>
        /// <param name="id">工程文件ID</param>
        /// <returns></returns>
        public List<LandNode> GetAllLandNodesById(string id)
        {
            return objLandNodeService.GetAllLandNodesById(id);
        }
        /// <summary>
        /// 根据地标号和ID号获取地标信息
        /// </summary>
        /// <param name="landNum">地标号</param>
        /// <param name="id">工程ID</param>
        /// <returns></returns>
        public LandNode GetLandNode(string landNum, string id)
        {
            return objLandNodeService.GetLandNode(landNum,id);
        }
         /// <summary>
        /// 根据地标号Id获取地标信息
        /// </summary>
        /// <param name="landNum">地标号</param>
        /// <param name="id">工程ID</param>
        /// <returns></returns>
        public LandNode GetLandNodeByLandId(string landId)
        {
            return objLandNodeService.GetLandNodeByLandId(landId);
        }
         /// <summary>
        /// 批量增加节点信息
        /// </summary>
        /// <param name="listNodes"></param>
        /// <returns></returns>
        public bool AddNodes(List<LandNode> listNodes)
        {
            return objLandNodeService.AddNodes(listNodes);
        }
        /// <summary>
        /// 增加一个地标信息
        /// </summary>
        /// <param name="objLandNode"></param>
        /// <returns>返回自增ID</returns>
        public int AddOneNodes(LandNode objLandNode)
        {
            if (objLandNodeService.IsExistsNodes(objLandNode.LandNum.ToString(), objLandNode.ID.ToString()) > 0)
            {
                return -1; //已存在添加不成功
            }
            else
            {
                return objLandNodeService.AddOneNodes(objLandNode);
            }
        }
        /// <summary>
        /// 删除地标信息
        /// </summary>
        /// <param name="listNodes"></param>
        /// <returns></returns>
        public bool DeleteNodes(List<LandNode> listNodes)
        {
            return objLandNodeService.DeleteNodes(listNodes);
        }
        public int DeleteNodes(string id)
        {
            return objLandNodeService.DeleteNodes(id);
        }
          /// <summary>
        /// 修改地标信息
        /// </summary>
        /// <param name="listNodes"></param>
        /// <returns></returns>
        public bool UpdateNodes(List<LandNode> listNodes)
        {
            return objLandNodeService.UpdateNodes(listNodes);
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="objLandNode"></param>
        /// <returns></returns>
        public int UpdateNodes(LandNode objLandNode)
        {
            if (objLandNodeService.IsExistsNodes(objLandNode.LandNum.ToString(), objLandNode.ID.ToString()) > 0)
            {
                return -1; //已存在添加不成功
            }
            else
            {
                return objLandNodeService.UpdateNodes(objLandNode);
            }
        }
    }
}
